home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / prodpack.zip / DB4PPSRC.EXE / _COLORSE.PRG < prev    next >
Text File  |  1993-05-04  |  3KB  |  80 lines

  1. FUNCTION _ColorSet                      && Set Color Attributes
  2. PARAMETERS pc_setclr
  3. *--------------------------------------------------------------------
  4. * NAME
  5. *   _ColorSet - Set color attributes.
  6. *
  7. * SYNOPSIS
  8. *   _ColorSet( pc_setclr )
  9. *
  10. * DESCRIPTION
  11. *   _ColorSet() will set the eight dBASE color values
  12. *   based on its string argument.  Such a string
  13. *   is most commonly obtained by calling
  14. *   SET("ATTRIBUTES").
  15. *
  16. * PARAMETER
  17. *   pc_setclr - A string of the type returned by
  18. *               SET("ATTRIBUTES").
  19. *
  20. * EXAMPLES
  21. *
  22. *   lc_prevcol = SET("ATTRIBUTES")      && Save current colors
  23. *   SET COLOR TO w+/b,gr+/n             && Change standard colors
  24. *   SET COLOR OF INFORMATION TO w+/r    && Change INFORMATION colors
  25. *     ...
  26. *   lc_tmp = _ColorSet("lc_prevcol")    && Restore colors back to before
  27. *
  28. * NOTES
  29. *   Note that the dBASE IV SET("ATTRIBUTES") function
  30. *   returns a string containing "&&".  These ampersands
  31. *   are required for _ColorSet() to properly set the
  32. *   color values.  This version is also very bullet
  33. *   susceptible.
  34. *
  35. * SEE ALSO
  36. *   SET("ATTRIBUTES"), _ColorChk()
  37. *
  38. *--------------------------------------------------------------------
  39.  
  40.   PRIVATE lc_colstr, lc_colatt
  41.  
  42.   *-- Pick out individual colors:
  43.   *  (pc_setclr is used directly first two times for speed)
  44.   lc_colatt = SUBSTR( pc_setclr, 1, AT( "," , pc_setclr) - 1)
  45.   SET COLOR OF NORMAL TO &lc_colatt.
  46.  
  47.   lc_colstr = SUBSTR( pc_setclr, AT(",", pc_setclr) + 1 )
  48.   lc_colatt = SUBSTR( lc_colstr, 1, AT( ",", lc_colstr) - 1)
  49.   SET COLOR OF HIGHLIGHT TO &lc_colatt.
  50.  
  51.   lc_colstr = SUBSTR( lc_colstr, AT(",", lc_colstr) + 1 )
  52.   *  Use the " && " this time instead of ",":
  53.   lc_colatt = SUBSTR( lc_colstr, 1, AT( " &", lc_colstr) - 1)
  54.   SET COLOR TO ,,&lc_colatt.            && No PERIMITER keyword.
  55.  
  56.   *  Use the " && " instead of "," here:
  57.   lc_colstr = SUBSTR( lc_colstr, AT(" &", lc_colstr) + 4 )
  58.   lc_colatt = SUBSTR( lc_colstr, 1, AT( ",", lc_colstr) - 1)
  59.   SET COLOR OF MESSAGES TO &lc_colatt.
  60.  
  61.   lc_colstr = SUBSTR( lc_colstr, AT(",", lc_colstr) + 1 )
  62.   lc_colatt = SUBSTR( lc_colstr, 1, AT( ",", lc_colstr) - 1)
  63.   SET COLOR OF TITLES TO &lc_colatt.
  64.  
  65.   lc_colstr = SUBSTR( lc_colstr, AT(",", lc_colstr) + 1 )
  66.   lc_colatt = SUBSTR( lc_colstr, 1, AT( ",", lc_colstr) - 1)
  67.   SET COLOR OF BOX TO &lc_colatt.
  68.  
  69.   lc_colstr = SUBSTR( lc_colstr, AT(",", lc_colstr) + 1 )
  70.   lc_colatt = SUBSTR( lc_colstr, 1, AT( ",", lc_colstr) - 1)
  71.   SET COLOR OF INFORMATION TO &lc_colatt.
  72.  
  73.   lc_colstr = SUBSTR( lc_colstr, AT(",", lc_colstr) + 1 )
  74.   SET COLOR OF FIELDS TO &lc_colstr.
  75.  
  76. RETURN .T.
  77.  
  78. *-- EOF: _ColorSet( pc_setclr )
  79.  
  80.